package com.chengqs.gulimall.seckill.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: chengqs
 * @create: 2025-05-34 23:34:55
 **/
@Configuration
public class MyRedissonConfig {

    @Bean(destroyMethod = "shutdown")
    RedissonClient redisson() throws Exception {
        // 1. 创建配置
        Config config = new Config();
        config.useSingleServer()
                .setAddress("redis://121.43.238.92:6379")
                .setPassword("Chengqs20020422,.")
                .setTimeout(5000);
        // 2. 创建实例
        RedissonClient redissonClient = Redisson.create(config);
        return redissonClient;
    }
}
